package main

import "fmt"

type Person struct {
	name string
	age  int
}

type Student struct {
	Person
	class string
}
type Student1 struct {
	p     Person
	class string
}

func main() {

	var p Person
	p.age = 20
	fmt.Println(p)

	var p1 = Person{name: "aa"}
	fmt.Println(p1)

	p2 := Person{name: "aa"}
	fmt.Println(p2)

	var sp []Person
	sp = append(sp, p)
	sp = append(sp,
		Person{name: "aa", age: 30},
	)
	var sp2 = []Person{
		{name: "aa", age: 30},
		{name: "cc"},
	}

	fmt.Println(sp2)
	st := struct {
		name string
	}{
		"aa",
	}
	fmt.Println(st)

	var stu = Student{}
	stu = Student{
		Person: Person{name: "cc", age: 30},
		class:  "5c",
	}
	fmt.Println(stu)
	stu1 := Student{
		Person: Person{"cc2", 50},
		class:  "",
	}
	fmt.Println(stu1.age)
	var stu2 = Student{
		Person: Person{age: 30},
		class:  "1A",
	}
	stu2.name = "stu2"
	fmt.Println(stu2)

	var stu3 = Student1{
		p:     Person{"xx", 60},
		class: "stu3",
	}
	fmt.Println(stu3.p.name)
}
